<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./../template/adminTemp.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns="http://www.w3.org/1999/xhtml">
    <ui:define name="content">
        <section class="grid_6 first">
            <div class="columns">
                <div class="grid_6 first">
                    <h:form prependId="false" styleClass="form panel" id="form">
                        <p:dataTable var="branch" value="#{branchManagedBean.all}"
                                     paginator="true" rows="10"
                                     paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}"
                                     rowsPerPageTemplate="10" >
                            <p:column>
                                <f:facet name="header">Branch's name</f:facet>
                                <h:outputText value="#{branch.branchName}" />
                            </p:column>

                            <p:column>
                                <f:facet name="header">Address</f:facet>
                                <h:outputText value="#{branch.address}" style="height:30px" />
                            </p:column>

                            <p:column>
                                <f:facet name="header">Email</f:facet>
                                <h:outputLink value="mailto:#{branch.email}">#{branch.email}</h:outputLink>
                            </p:column>

                            <p:column>
                                <f:facet name="header">Telephone</f:facet>
                                <h:outputText value="#{branch.phoneNo}"/>
                            </p:column> <p:column>
                                <f:facet name="header">Fax</f:facet>
                                <h:outputText value="#{branch.fax}"/>
                            </p:column>

                            <p:column>
                                <f:facet name="header">
                                    <h:outputText value="Edit/Delete" />
                                </f:facet>
                                <h:commandButton styleClass="button-orange" value="Edit" action="branchDetails">
                                    <f:setPropertyActionListener target="#{branchManagedBean.branchSelected}" value="#{branch}" />
                                </h:commandButton><br/>
                                <h:commandButton styleClass="button-gray" value="Delete" action="#{branchManagedBean.delete}">
                                    <f:setPropertyActionListener target="#{branchManagedBean.branchSelected}" value="#{branch}" />
                                </h:commandButton>
                            </p:column>
                        </p:dataTable>
<!--
                        <p:ajaxStatus   style="margin: 10px auto;width:150px;text-align: center;">
                            <f:facet name="start">
                                <h:graphicImage value="images/ajax-loader.gif" />
                            </f:facet>
                            <f:facet name="complete">
                                <h:outputText value="" />
                            </f:facet>
                        </p:ajaxStatus>-->
                    </h:form>

                </div>
            </div>
        </section>      
    </ui:define>

</ui:composition>
